home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
graphics
/
amicad
/
arexx_english
/
importtext.amicad
< prev
next >
Wrap
Text File
|
1999-12-06
|
2KB
|
80 lines
/* Import a text in a box */
/* $VER: ImportText 1.02e (© R.Florac, 22 mai 1999) */
options results
signal on error
signal on syntax
'FIRSTSEL'; obj=result
if obj>0 then do
'TYPE('obj')'
if result=22 then do
'NEXTSEL('obj')'
if result=0 then do
'COORDS('obj')';
PARSE VAR result x0 ',' y0 ',' x1 ',' y1
xg=minima(x0,x1); xd=maxima(x0,x1)
yh=minima(y0,y1); yb=maxima(y0,y1)
'REQFILE("Name of the text file?", "Work:text/ASCII")'; fichier=result
y0=yh
if fichier ~= "" then do
if open(file, fichier, 'R') then do
y0=y0+10
'SAVEALL(-1)'
do while y0 < y1
ligne=readln(file)
if ligne ~= "" then do
ligne=translate(ligne," ",'09'x)
'WRITE("'doublage_guillemets(ligne)'",'xg','y0')'; e=result
if e=0 then do
'REQUEST("Text placement in line"+CHR(10)+"'ligne'"+CHR(10)+"impossible."+CHR(10)+"Do you want to continue?")'
if result=0 then leave
end
y0=y0+10
end
if eof(file) then leave
end
close(file)
end
end
exit
end
end
end
'MESSAGE("Draw and select a box"+CHR(10)+"where you want to"+CHR(10)+"put the text")'
exit
minima: procedure
parse arg v1,v2
if v1<v2 then return v1
return v2
end
maxima: procedure
parse arg v1,v2
if v1>v2 then return v1
return v2
end
doublage_guillemets: procedure
parse arg chaine
t=''
do i=1 to length(chaine)
c = substr(chaine,i,1)
if c='"' then c=c||'"'
t=t||c
end
return t
syntax:
erreur=RC
'MESSAGE("Script ImportText.AmiCAD"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
exit
error:
'MESSAGE("Script ImportText.AmiCAD"+CHR(10)+"Error in line 'SIGL'")'
exit